<template>
  <div>
    <!-- 面包屑导航区 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片视图 -->
    <el-card>
      <el-table :data="rightsList" border stripe>
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column label="权限名称" prop="authName"></el-table-column>
        <el-table-column label="权限描述" prop="desc"></el-table-column>
        <el-table-column label="权限等级" prop="level">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level === '0'">一级</el-tag>
            <el-tag type="success" v-else-if="scope.row.level === '1'">二级</el-tag>
            <el-tag type="danger" v-else>三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  data () {
    return {
      // 权限列表
      /*rightsList: [
        {
            "id": 101,
            "authName": "基本权限",
            "level": "0",
            "pid": 0,
            "desc": "普通党员一级权限"
        },
        {
            "id": 103,
            "authName": "缴费权限",
            "level": "1",
            "pid": 101,
            "desc": "普通党员缴费权限"
        },
        {
            "id": 105,
            "authName": "缴费党费",
            "level": "2",
            "pid": 103,
            "desc": "普通党员每月缴纳党费"
        },
        {
            "id": 102,
            "authName": "高级权限",
            "level": "0",
            "pid": 0,
            "desc": "支部领导一级权限"
        },
        {
            "id": 104,
            "authName": "缴费权限",
            "level": "1",
            "pid": 102,
            "desc": "支部领导缴费权限"
        },
        {
            "id": 106,
            "authName": "缴纳党费",
            "level": "2",
            "pid": 104,
            "desc": "支部领导每月缴纳党费"
        },
        {
            "id": 108,
            "authName": "查询权限",
            "level": "1",
            "pid": 102,
            "desc": "支部领导查询权限"
        },
        {
            "id": 110,
            "authName": "查询个人缴费记录权限",
            "level": "2",
            "pid": 108,
            "desc": "支部领导查询支部党费个人缴费记录权限"
        },
        {
            "id": 112,
            "authName": "查询支部缴费记录权限",
            "level": "2",
            "pid": 108,
            "desc": "支部领导查询支部每月缴费记录权限"
        },

    ],*/
    rightsList:[]
    }
  },
  created () {
    this.getRightsList()
  },
  methods: {
    async getRightsList () {
      const { data: res } = await this.$http.get('rightList')
      console.log(res);
      this.rightsList = res
    }
  }
}
</script>

<style lang='less' scoped>
</style>
